<me:UIVESTAMM x:Class="WPFExcelReport.TVESTAMM"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization" 
                    x:Name="TV"
                    FontSize="14"
                    Loaded="Window_Loaded"
     >
    <me:UIVESTAMM.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIVESTAMM.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0">
            <WrapPanel>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <me:TSVS02  Grid.Column="1" dwVS="{Binding dwVS,ElementName=TV}"/>
                </Grid>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=代理名称:}}"></TextBlock>
                    <ex:TXT72 MaxLength="8" Grid.Column="1" CharacterCasing="Upper" 
                              Text="{Binding ART,ElementName=TV, Converter={StaticResource gb2312}}" Width="100" />
                </Grid>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=公司名称:}}"></TextBlock>
                    <ex:TXT72 MaxLength="40" Grid.Column="1" CharacterCasing="Upper" 
                              Text="{Binding DES,ElementName=TV, Converter={StaticResource gb2312}}" Width="200" />
                </Grid>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                        </Button.Background>
                    </Button>
                </Grid>

            </WrapPanel>
            <WrapPanel  Grid.Row="0">
                <Grid Margin="10,0,0,0" Visibility="{Binding IsCanChg,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button  Click="EditCommand" Width="24" Height="20">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsCanDelete,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsCanCopy,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                        </Button.Background>
                    </Button>
                    <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
                        <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=复制为代理名称:}}"></TextBlock>
                        <ex:TXT72 MaxLength="8" Grid.Column="1" CharacterCasing="Upper" 
                                  Text="{Binding ERTNA,ElementName=TV, Converter={StaticResource gb2312}}" 
                                  Width="100" />
                        <Button   Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                            </Button.Background>
                        </Button>
                    </WrapPanel>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsCanNew,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}"> 
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=新代理名称:}}"></TextBlock>
                    <ex:TXT72 MaxLength="8" Grid.Column="1" CharacterCasing="Upper" 
                              Text="{Binding ERTNA,ElementName=TV, Converter={StaticResource gb2312}}" 
                              Width="100" />
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                </WrapPanel>
            </WrapPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1" 
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   IsReadOnly="True"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"     
                   ItemsSource="{Binding Source={StaticResource vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster"   
                    >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=VEVERTNR}" Header="{Binding Source={Localization:Translate Word=代理编号}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VEVERTNA, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=代理名称}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VENAME1, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=公司名称}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VESTRASSE1, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=地址}}"  Width="Auto" /> 
            </DataGrid.Columns>
        </DataGrid  >
        <WrapPanel Grid.Row="2">
            <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=更改:}}"></TextBlock>
            <TextBlock  Grid.Column="0" Text="{Binding VEAENB}"></TextBlock>
            <TextBlock  Grid.Column="0" Text="{Binding VEAEND}"></TextBlock> 
            <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=创建:}}"></TextBlock>
            <TextBlock  Grid.Column="0" Text="{Binding VENEUB}"></TextBlock>
            <TextBlock  Grid.Column="0" Text="{Binding VENEUD}"></TextBlock>  
        </WrapPanel>
    </Grid>
</me:UIVESTAMM>
